home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Interfaces / CIncludes / OCETemplates.h < prev   
Encoding:
C/C++ Source or Header  |  1993-11-10  |  55.2 KB  |  1,499 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Tuesday, August 17, 1993 4:37:24 PM
  4.  OCETemplates.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1990-1993
  8.   All rights reserved
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef __OCETEMPLATES__
  14. #define __OCETEMPLATES__
  15.  
  16. #ifndef REZ
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21. #ifndef __EVENTS__
  22. #include <Events.h>
  23. #endif
  24.  
  25. #endif
  26.  
  27. #ifndef __OCE__
  28. #include "OCE.h"
  29. #endif
  30.  
  31. #ifndef REZ
  32. #ifndef __OCESTANDARDMAIL__
  33. #include "OCEStandardMail.h"
  34. #endif
  35. #endif
  36.  
  37.  
  38. /************************************************************************************************/
  39. /********************************* Template Resource Constants: *********************************/
  40. /************************************************************************************************/
  41.  
  42.  
  43. /* Current versions of all the different template types: */
  44.  
  45. #define kDETAspectVersion        -976
  46. #define kDETInfoPageVersion        -976
  47. #define kDETKillerVersion        -976
  48. #define kDETForwarderVersion    -976
  49. #define kDETFileTypeVersion        -976
  50.  
  51.  
  52. /*    "Normal" separation for template IDs within the file (this is just a suggestion; you can use whatever
  53.     separation you like, so long as two separate templates don't have overlapping resources): */
  54. #define kDETIDSep 250
  55.  
  56. /* A few predefined base IDs (again, just suggestions): */
  57. #define kDETFirstID        (1000)
  58. #define kDETSecondID    (1000+kDETIDSep)
  59. #define kDETThirdID        (1000+2*kDETIDSep)
  60. #define kDETFourthID    (1000+3*kDETIDSep)
  61. #define kDETFifthID        (1000+4*kDETIDSep)
  62.  
  63. /*    Templates consist of a set of associated resources, at constant offsets from a "base ID" set by the
  64.     signature resource of the template. In the case of aspect templates, most of the resources in the
  65.     template are accessible from the template as property default values. The property number is the same
  66.     as the offset from the base ID of the resource. In describing the resources which make up templates,
  67.     we give the type, the offset, and a description. For aspect templates, the offset is also the property #. */
  68.     
  69. /*    All templates include the following resource fork resources:
  70.  
  71.      Type    Offset                        Description
  72.      ----    ------                        -----------
  73.     'rstr'    kDETTemplateName            Contains the name of the template
  74.  
  75. */
  76.  
  77. #define kDETTemplateName 0
  78.  
  79. /*    Aspects, info-pages, and forwarders include the following as well:
  80.  
  81.      Type    Offset                        Description
  82.      ----    ------                        -----------
  83.     'rstr'    kDETRecordType                Contains the type of record this applies to
  84.     'rstr'    kDETAttributeType            Contains the type of attribute this applies to
  85.     'detn'    kDETAttributeValueTag        Contains the tag of the attribute values this applies to
  86.  
  87. */
  88.  
  89. #define kDETRecordType                1
  90. #define kDETAttributeType            2
  91. #define kDETAttributeValueTag        3
  92.  
  93.  
  94. /* ************************************ Aspects */
  95.  
  96. /*    In the case of aspects, property numbers and resource id offsets are the same. Therefore, some of the following
  97.     defines are used for resource offsets, some are used for dynamically generated properties, and some are used for
  98.     both (i.e., properties which may be dynamically generated, but if they aren't, then they're taken from the
  99.     resource). Resource types are given in all cases below; even if there is no actual resource (for example in
  100.     the case of kDETAspectName), it indicates the type for the dynamically generated property. A resource type of
  101.     'rstr' corresponds to a property type of kDETPrTypeString; type 'detn' corresponds to kDETPrTypeNumber; and
  102.     'detb' corresponds to kDETPrTypeBinary.
  103.  
  104.      Type    Offset                        Description
  105.      ----    ------                        -----------
  106.     'deta'    0                            Identifies the type of resource
  107.     'detc'    kDETCode                    Is the code resource, if any is used
  108.     'ICN#'    kDETAspectMainBitmap
  109.     'icl8'    kDETAspectMainBitmap
  110.     'icl4'    kDETAspectMainBitmap
  111.     'ics#'    kDETAspectMainBitmap
  112.     'ics8'    kDETAspectMainBitmap
  113.     'ics4'    kDETAspectMainBitmap
  114.     'sicn'    kDETAspectMainBitmap        Is the icon suite to display for this item type (main aspect only)
  115.     'rstr'    kDETAspectName                Contains the name of the item (attribute main aspect only)
  116.     'rst#'    kDETAspectCategory            Contains the internal categories for the record type (main aspect only)
  117.     'rst#'    kDETAspectExternalCategory    Contains the external (user-visible) names which correspond to the categories in
  118.                                         kDETAspectCategory; if this resource is not present, external names are taken from
  119.                                         another template; if no other template provides an external name for a given internal
  120.                                         category, the internal name is used as the external name (main aspect only)
  121.     'rstr'    kDETAspectKind                Is the item kind to display (main aspect only)
  122.     'detn'    kDETAspectGender            Is the gender of this kind of object for internationalization (main aspect only)
  123.     'rstr'    kDETAspectWhatIs            Is the string for balloon help when item is in sublist (main aspect only)
  124.     'rstr'    kDETAspectAliasKind            Is the item kind to display for aliases to this type of item (main aspect only)
  125.     'detn'    kDETAspectAliasGender        Is the gender of an alias to this kind of object for internationalization (main aspect only)
  126.     'rstr'    kDETAspectAliasWhatIs        Is the string for balloon help when an alias to the item is in sublist (main aspect only)
  127.     'rst#'    kDETAspectBalloons            Is a list of strings for balloon help; for each item in an info-page, it's
  128.                                         property # times 2 is used as an index into this array; if the item is not editable,
  129.                                         then the property # times 2 plus 1 is used
  130.     'rstr'    kDETAspectNewMenuName        Is the string to be used for the user to select new item creation; for records, the
  131.                                         string is used as a menu entry in the Catalogs menu; for attributes, the string
  132.                                         is used in a selection dialog invoked by an "Add..." button
  133.     'rstr'    kDETAspectNewEntryName        Is the name to be used for new records (with a digit appended if not unique)
  134.     'detb'    kDETAspectNewValue            Is the value to use when creating a new attribute value; the first four bytes
  135.                                         is the tag; the rest is the attribute value contents
  136.     'detn'    kDETAspectSublistOpenOnNew    If true (non-zero), automatically open newly created entries (property can be set
  137.                                         from a code resource, or via a default value in a resource)
  138.     'dett'    kDETAspectLookup            Is the attribute-to-property translation table
  139.     'rstr'    kDETAspectDragInString        Is a string describing the action of dragging into this aspect (if any)
  140.     'rstr'    kDETAspectDragInVerb        Is a single, short word that's the verb of the action (like "add" or "drop"; if
  141.                                         there's any doubt, use "OK")
  142.     'rstr'    kDETAspectDragInSummary        Is a short phrase that describes the action, suitable to be included in a selection list
  143.     'rst#'    kDETAspectRecordDragIn        Is a list of type pairs; in each pair, the first is the type of a record which
  144.                                         can be dragged into this aspect, and the second is the attribute type to store
  145.                                         the reference in
  146.     'rst#'    kDETAspectRecordCatDragIn    Is a list of category/attribute type pairs; in each pair, the first is the
  147.                                         category of records which can be dragged in, and the second is the type of
  148.                                         attribute to place the alias in
  149.     'rst#'    kDETAspectAttrDragIn        Is a list of type triples; in each triple, the first is the record type which can be
  150.                                         dragged from (or "" for any), the second is the attribute type which can be dragged
  151.                                         in, and the third is the attribute type to store the new attribute in
  152.     'rst#'    kDETAspectDragOut            Is a list of attribute types which can be dragged out of this aspect (an 'rst#'
  153.                                         resource with no entries means nothing can be dragged out; no 'rst#' resource means
  154.                                         everything can be dragged out)
  155.     'detm'    kDETAspectViewMenu            Is a table to fill in the view menu from
  156.     'detp'    kDETAspectReverseSort        Is a table listing which properties to sort in reverse order
  157.     'detw'    kDETAspectInfoPageCustomWindow    Is a specification of a custom window size/placement & whether to use the
  158.                                             page-selector (main aspect only)
  159.     'detv'    kDETAspectInfoPageCustomWindow    Is a view list which is common to all info-pages (main aspect only)
  160. */
  161.  
  162. #define kDETAspectCode                     4
  163. #define kDETAspectMainBitmap             5
  164. #define kDETAspectName                     6
  165. #define kDETAspectCategory                 7
  166. #define kDETAspectExternalCategory         8
  167. #define kDETAspectKind                     9
  168. #define kDETAspectGender                10
  169. #define kDETAspectWhatIs                11
  170. #define kDETAspectAliasKind                12
  171. #define kDETAspectAliasGender            13
  172. #define kDETAspectAliasWhatIs            14
  173. #define kDETAspectBalloons                15
  174. #define kDETAspectNewMenuName            16
  175. #define kDETAspectNewEntryName            17
  176. #define kDETAspectNewValue                18
  177. #define kDETAspectSublistOpenOnNew        19
  178. #define kDETAspectLookup                20
  179. #define kDETAspectDragInString            21
  180. #define kDETAspectDragInVerb            22
  181. #define kDETAspectDragInSummary            23
  182. #define kDETAspectRecordDragIn            24
  183. #define kDETAspectRecordCatDragIn        25
  184. #define kDETAspectAttrDragIn            26
  185. #define kDETAspectAttrDragOut            27
  186. #define kDETAspectViewMenu                28
  187. #define kDETAspectReverseSort            29
  188. #define kDETAspectInfoPageCustomWindow    30
  189.  
  190.  
  191. /* Properties: */
  192.  
  193. #define kDETNoProperty                -1
  194.  
  195. /* Each aspect has 250 attribute properties in this range: */
  196. #define kDETFirstLocalProperty        0
  197. #define kDETLastLocalProperty         (kDETFirstLocalProperty+249)
  198.  
  199. /* Developers should use property numbers starting at this point: */
  200. #define kDETFirstDevProperty        40
  201.  
  202. /* The following range provides constant numeric properties for use in patterns and comparisons (constant n is
  203.    given by kDETFirstConstantProperty+n): */
  204. #define kDETFirstConstantProperty    250
  205. #define kDETLastConstantProperty    (kDETFirstConstantProperty+249)
  206.  
  207. /* To convert a number into a constant property, add this: */
  208. #define kDETConstantProperty        kDETFirstConstantProperty
  209.  
  210. #define kDETZeroProperty            (kDETConstantProperty+0)
  211. #define kDETOneProperty                (kDETConstantProperty+1)
  212. #define kDETFalseProperty            (kDETConstantProperty+0)
  213. #define kDETTrueProperty            (kDETConstantProperty+1)
  214.  
  215. /* The following apply to records, attributes, or aliases; they are the name and kind, as they appear in icon lists: */
  216. #define kDETPrName                     3050
  217. #define kDETPrKind                     3051
  218.  
  219. /* Access mask properties: */
  220. #define kDETDNodeAccessMask            25825    /* The DNode access mask */
  221. #define kDETRecordAccessMask        25826    /* The record access mask */
  222. #define kDETAttributeAccessMask        25827    /* The attribute access mask */
  223. #define kDETPrimaryMaskByBit        25828    /* A set of sixteen properties to access all bits of the primary mask */
  224.  
  225. /* See AOCE documentation for details definitions of each of these bits: */
  226. #define kDETPrimarySeeMask            kDETPrimaryMaskByBit
  227. #define kDETPrimaryAddMask            (kDETPrimaryMaskByBit+1)
  228. #define kDETPrimaryDeleteMask        (kDETPrimaryMaskByBit+2)
  229. #define kDETPrimaryChangeMask        (kDETPrimaryMaskByBit+3)
  230. #define kDETPrimaryRenameMask        (kDETPrimaryMaskByBit+4)
  231. #define kDETPrimaryChangePrivsMask    (kDETPrimaryMaskByBit+5)
  232. #define kDETPrimaryTopMaskBit        (kDETPrimaryMaskByBit+15)
  233.  
  234. /* The following property is zero until we've completed the first catalog lookup; from then on it's 1 */
  235. #define kDETPastFirstLookup            26550
  236.  
  237. /* The following property is the page number; issuing a property command with this property will flip info-pages */
  238. #define kDETInfoPageNumber            27050
  239.  
  240. /* The value of the following properties contains the template number of the targeted aspect's template, and the
  241.    currently open info-page (if any). These values can be used with kDETAspectTemplate and kDETInfoPageTemplate
  242.    target selectors. */
  243. #define kDETAspectTemplateNumber    26551
  244. #define kDETInfoPageTemplateNumber    26552
  245.  
  246. /* Properties for property commands to deal with sublist items: */
  247. #define kDETOpenSelectedItems        26553    /* Open selected sublist items */
  248. #define kDETAddNewItem                26554    /* Add new sublist item */
  249. #define kDETRemoveSelectedItems        26555    /* Remove selected sublist items */
  250.  
  251. /* Property types are used to specify types of properties and conversions between types (zero and negative numbers
  252.    are reserved for Apple; developer code resources can use positive numbers): */
  253. #define kDETPrTypeNumber            -1    /* A number */
  254. #define kDETPrTypeString            -2    /* A string */
  255. #define kDETPrTypeBinary            -3    /* A binary block */
  256.  
  257. /* Rez-compatible tag definitions (•••these are the same as in OCE.h, but they're enums there and can't be rezed•••) */
  258. #ifdef REZ
  259. #define typeRString            'rstr'
  260. #define typePackedDSSpec    'dspc'
  261. #define typeBinary            'bnry'
  262. #endif
  263.  
  264. /* ************************************ Info-pages */
  265.  
  266. /* Info-pages include the following as well:
  267.  
  268.      Type    Offset                        Description
  269.      ----    ------                        -----------
  270.     'deti'    0                            Identifies the type of resource; see below for details on the contents
  271.     'rstr'    kDETInfoPageName            Is the name of the view to use in the page selection pop-up
  272.     'rstr'    kDETInfoPageMainViewAspect    Is the name of the aspect to use with the main page view
  273.     'rstr'    kDETInfoPageMenuName        Is the name of the catalogs menu ("Catalogs" if not present)
  274.     'detm'    kDETInfoPageMenuEntries        Are menu entries to go in the Catalogs menu
  275.  
  276. */
  277.  
  278. #define kDETInfoPageName            4
  279. #define kDETInfoPageMainViewAspect    5
  280. #define kDETInfoPageMenuName        6
  281. #define kDETInfoPageMenuEntries        7
  282.  
  283.  
  284. /* ************************************ Views */
  285.  
  286. /* Flags: */
  287.  
  288. #define kDETNoFlags                        0
  289. #define kDETEnabled                        (1 << 0)    /* Main view (non-sublist) field enabled */
  290.  
  291. /* The following flags make sense for items in a sublist only */
  292. #define kDETHilightIfSelected            (1 << 0)    /* Hilight view when entry is selected */
  293.  
  294. /* The following flags make sense for text views only */
  295. #define kDETNumericOnly                    (1 << 3)    /* Only allow the user to enter digits */
  296. #define kDETMultiLine                    (1 << 4)    /* Allow multiple lines in view */
  297. #define kDETDynamicSize                    (1 << 9)    /* Don't draw box around text until user clicks in it, then auto-size it */
  298. #define kDETAllowNoColons                (1 << 10)    /* Don't allow the user to enter colons (convert ":"s to "-"s) */
  299.  
  300. /* The following flags are used for pop-up menus only */
  301. #define kDETPopupDynamicSize            (1 << 8)    /* Automatically resize pop-up based on contents */
  302.  
  303. /* The following flags are used for EditPicture views only */
  304. #define kDETScaleToView                    (1 << 8)    /* Scale picture to view bounds rather than cropping */
  305.  
  306. /*    Sizes for icons */
  307. #define kDETLargeIcon        0
  308. #define kDETSmallIcon        1
  309. #define kDETMiniIcon        2
  310.  
  311. /* Stolen from TextEdit.h */
  312. #define kDETLeft          0
  313. #define kDETCenter          1
  314. #define kDETRight         -1
  315. #define kDETForceLeft    -2
  316.  
  317. /* Flags for use within Box view type attributes - these are distinct from the flags above */
  318.  
  319. #define    kDETUnused                    0
  320. #define kDETBoxTakesContentClicks    (1 << 0)
  321. #define kDETBoxIsRounded            (1 << 1)
  322. #define kDETBoxIsGrayed                (1 << 2)
  323. #define kDETBoxIsInvisible            (1 << 3)
  324.  
  325. /* The common font info */
  326.  
  327. #define kDETApplicationFont                 1
  328. #define kDETApplicationFontSize          9
  329. #define kDETAppFontLineHeight            12
  330.  
  331. #define kDETSystemFont                     0
  332. #define kDETSystemFontSize                12
  333. #define kDETSystemFontLineHeight        16
  334.  
  335. #define kDETDefaultFont                     1
  336. #define kDETDefaultFontSize                 9
  337. #define kDETDefaultFontLineHeight        12
  338.  
  339. /*    These were taken from QuickDraw.h (where they're enums and therefore unusable in resource definitions): */
  340. #define kDETNormal                        0
  341. #define kDETBold                        1
  342. #define kDETItalic                        2
  343. #define kDETUnderline                    4
  344. #define kDETOutline                        8
  345. #define kDETShadow                     0x10
  346. #define kDETCondense                 0x20
  347. #define kDETExtend                     0x40
  348.  
  349. #define kDETIconStyle                   -3    /* Normal text style for regular sublist entries, italic text style for aliases */
  350.  
  351. /* View menu: */
  352.  
  353. #define    kDETChangeViewCommand        'view'    /* Change the view; used especially in StaticCommandTextFromView sublist headers */
  354.  
  355.  
  356. /* Info-page window sizes: */
  357.  
  358. /* Default record info-pages: */
  359. #define kDETRecordInfoWindHeight        228
  360. #define kDETRecordInfoWindWidth            400
  361.  
  362. /* Default attribute info-pages: */
  363. #define kDETAttributeInfoWindHeight        250
  364. #define kDETAttributeInfoWindWidth        230
  365.  
  366. /* Page identifying icon (for default info-page layout): */
  367. #define kDETSubpageIconTop        8
  368. #define kDETSubpageIconLeft        8
  369. #define kDETSubpageIconBottom    (kDETSubpageIconTop+32)
  370. #define kDETSubpageIconRight    (kDETSubpageIconLeft+32)
  371. #define kDETSubpageIconRect        {kDETSubpageIconTop, kDETSubpageIconLeft, kDETSubpageIconBottom, kDETSubpageIconRight}
  372.  
  373. /* The following rectangle can be used in a 'deti' with no sublist: */
  374. #define kDETNoSublistRect        {0, 0, 0, 0}
  375.  
  376.  
  377. /* ************************************ Killers */
  378.  
  379. /* Killers include the following as well:
  380.  
  381.      Type    Offset                        Description
  382.      ----    ------                        -----------
  383.     'detk'    0                            Identifies the type of resource; see below for details on the contents
  384.     'rst#'    kDETKillerName                Contains a list of template names to be killed
  385.  
  386. */
  387.  
  388. #define kDETKillerName 1
  389.  
  390.  
  391. /* ************************************ Forwarders */
  392.  
  393. /* Forwarders include the following as well:
  394.  
  395.      Type    Offset                        Description
  396.      ----    ------                        -----------
  397.     'detf'    0                            Identifies the type of resource; see below for details on the contents
  398.     'rst#'    kDETForwarderTemplateNames    Contains a list of names of templates to forward to
  399.  
  400. */
  401.  
  402. #define kDETForwarderTemplateNames    4
  403.  
  404.  
  405.  
  406.  
  407. /***********************************************************************************/
  408. /********************************* Categories: *************************************/
  409. /***********************************************************************************/
  410.  
  411. /* Internal category names: */
  412.  
  413. #define kDETCategoryAllItems        "aoce All Items"        /* Everything in or out of a category */
  414. #define kDETCategoryAddressItems    "aoce Address Items"    /* Anything that can be used to address something */
  415. #define kDETCategoryMisc            "aoce Miscellaneous"    /* Things that don't deserve their own category */
  416.  
  417.  
  418.  
  419.  
  420. /***********************************************************************************/
  421. /********************************* Code Resources: *********************************/
  422. /***********************************************************************************/
  423.  
  424. #ifndef REZ
  425.  
  426. /* Target specification: */
  427.  
  428. enum DETTargetSelector {
  429.     kDETSelf = 0,                    /* The "current" item */
  430.     kDETSelfOtherAspect,            /* Another aspect of the current item */
  431.     kDETParent,                        /* The parent (i.e., the aspect we're in the sublist of, if any) of the current item */
  432.     kDETSublistItem,                /* The itemNumberth item in the sublist */
  433.     kDETSelectedSublistItem,        /* The itemNumberth selected item in the sublist */
  434.     kDETDSSpec,                        /* The item specified by the packed DSSpec */
  435.     kDETAspectTemplate,                /* A specific aspect template (number itemNumber) */
  436.     kDETInfoPageTemplate,            /* A specific info-page template (number itemNumber) */
  437.     kDETHighSelector = 0xF000        /* Force type to be short */
  438. };
  439.  
  440. typedef enum DETTargetSelector DETTargetSelector;
  441.  
  442. struct DETTargetSpecification {
  443.     DETTargetSelector selector;            /* Target selection method (see above) */
  444.     RStringPtr aspectName;                /* The name of the aspect (kDETSelfOtherAspect, kDETSublistItem,
  445.                                            kDETSelectedSublistItem, kDETDSSpec); nil for main aspect or none;
  446.                                            always filled in for calls if there is an aspect, even if it's the main aspect */
  447.     long itemNumber;                    /* Sublist index (kDETSublistItem & kDETSelectedSublistItem & kDETAspectTemplate);
  448.                                            1-based indexing */
  449.     PackedDSSpecPtr dsSpec;                /* DSSpec (kDETDSSpec only) */
  450. };
  451.  
  452. typedef struct DETTargetSpecification DETTargetSpecification;
  453.  
  454. /* Code resource calls and call-backs both return an OSType:
  455.         kDETDidNotHandle (1)    = used by template to say "I didn't handle it" (for calls only)
  456.         noErr                    = function completed successfully
  457.         any error                = function failed, and here's why
  458. */
  459.  
  460. #define kDETDidNotHandle 1
  461.  
  462. /* Call-back functions:
  463.  
  464.         reqFunction                            Action
  465.         -----------                            ------
  466.         kDETcmdBeep                            Call SysBeep; useful for testing that a code resource's calls/call-backs are working at all
  467.  
  468.         kDETcmdBusy                            Put up watch cursor and switch processes; user events elicit a beep
  469.  
  470.         kDETcmdChangeCallFors                Change call-fors mask
  471.  
  472.         kDETcmdGetCommandSelectionCount        Get the command selection count (for calls which have a command selection list)
  473.         kDETcmdGetCommandItemN                Get command selection item n (for calls which have a command selection list)
  474.  
  475.         kDETcmdOpenDSSpec                    PackedDSSpec open (can also be done via AppleEvents -- this is a short-cut)
  476.  
  477.         kDETcmdAboutToTalk                    About to talk to user: bring us to front, disable watch cursor, etc.
  478.  
  479.         kDETcmdUnloadTemplates                Flush templates
  480.  
  481.         kDETcmdTemplateCounts                Return number of aspect and info-page templates in system
  482.  
  483.         kDETcmdGetDSSpec                    Get the PackedDSSpec for this object
  484.  
  485.         kDETcmdSublistCount                    Return the count of the sublist items
  486.         kDETcmdSelectedSublistCount            Return the count of the selected sublist items
  487.  
  488.         kDETcmdRequestSync                    Request a sync-up of the aspect with the catalog
  489.  
  490.         kDETcmdBreakAttribute                Break an attribute -- apply all applicable patterns to an attribute to generate properties
  491.  
  492.         kDETcmdGetTemplateFSSpec            Get the FSSpec of the file containing the template
  493.  
  494.         kDETcmdGetOpenEdit                    Return the property of the view being edited (or kDETNoProperty if none)
  495.         kDETcmdCloseEdit                    Close the current edit
  496.  
  497.         kDETcmdGetPropertyType                Get a property type
  498.  
  499.         kDETcmdGetPropertyNumber            Get a property, number format
  500.         kDETcmdGetPropertyRString            Get a property, RString format
  501.         kDETcmdGetPropertyBinarySize        Get a property, binary, return size
  502.         kDETcmdGetPropertyBinary            Get a property, binary format
  503.  
  504.         kDETcmdGetPropertyChanged            Get a property changed flag
  505.         kDETcmdGetPropertyEditable            Get a property editable flag
  506.  
  507.         kDETcmdSetPropertyType                Set a property type
  508.  
  509.         kDETcmdSetPropertyNumber            Set a property, number format
  510.         kDETcmdSetPropertyRString            Set a property, RString format
  511.         kDETcmdSetPropertyBinary            Set a property, binary data & size
  512.  
  513.         kDETcmdSetPropertyChanged            Set a property changed flag
  514.         kDETcmdSetPropertyEditable            Set a property editable flag
  515.  
  516.         kDETcmdDirtyProperty                Dirty a property (notify other code resources of change)
  517.  
  518.         kDETcmdDoPropertyCommand            Issue a property command
  519.  
  520.         kDETcmdAddMenu                        Add to the end of a dynamic menu
  521.         kDETcmdRemoveMenu                    Remove a dynamic menu item
  522.         kDETcmdMenuItemRString                Get a dynamic menu item RString
  523.  
  524.         kDETcmdSaveProperty                    Force a save of a property -- apply all applicable patterns to write out the property
  525.  
  526.         kDETcmdGetCustomViewUserReference    Get custom view user reference (as given in .r file)
  527.         kDETcmdGetCustomViewBounds            Get custom view current bounds
  528.  
  529.         kDETcmdGetResource                    Get a resource from a template
  530. */
  531.  
  532.  
  533. enum DETCallBackFunctions {
  534.  
  535.     kDETcmdSimpleCallback = 0,
  536.     kDETcmdBeep,
  537.     kDETcmdBusy,
  538.     kDETcmdChangeCallFors,
  539.     kDETcmdGetCommandSelectionCount,
  540.     kDETcmdGetCommandItemN,
  541.     kDETcmdOpenDSSpec,
  542.     kDETcmdAboutToTalk,
  543.     kDETcmdUnloadTemplates,
  544.     kDETcmdTemplateCounts,
  545.  
  546.     kDETcmdTargetedCallback = 1000,
  547.     kDETcmdGetDSSpec,
  548.     kDETcmdSublistCount,
  549.     kDETcmdSelectedSublistCount,
  550.     kDETcmdRequestSync,
  551.     kDETcmdBreakAttribute,
  552.     kDETcmdGetTemplateFSSpec,
  553.     kDETcmdGetOpenEdit,
  554.     kDETcmdCloseEdit,
  555.  
  556.     kDETcmdPropertyCallback = 2000,
  557.     kDETcmdGetPropertyType,
  558.     kDETcmdGetPropertyNumber,
  559.     kDETcmdGetPropertyRString,
  560.     kDETcmdGetPropertyBinarySize,
  561.     kDETcmdGetPropertyBinary,
  562.     kDETcmdGetPropertyChanged,
  563.     kDETcmdGetPropertyEditable,
  564.     kDETcmdSetPropertyType,
  565.     kDETcmdSetPropertyNumber,
  566.     kDETcmdSetPropertyRString,
  567.     kDETcmdSetPropertyBinary,
  568.     kDETcmdSetPropertyChanged,
  569.     kDETcmdSetPropertyEditable,
  570.     kDETcmdDirtyProperty,
  571.     kDETcmdDoPropertyCommand,
  572.     kDETcmdAddMenu,
  573.     kDETcmdRemoveMenu,
  574.     kDETcmdMenuItemRString,
  575.     kDETcmdSaveProperty,
  576.     kDETcmdGetCustomViewUserReference,
  577.     kDETcmdGetCustomViewBounds,
  578.     kDETcmdGetResource,
  579.  
  580.     kDETcmdHighCallback = 0xF0000000        /* Force type to be long */
  581. };
  582.  
  583. typedef enum DETCallBackFunctions DETCallBackFunctions;
  584.  
  585.  
  586. #define DETCallBackBlockHeader \
  587.     DETCallBackFunctions reqFunction;    /* Requested function */
  588.  
  589. #define DETCallBackBlockTargetedHeader \
  590.     DETCallBackFunctions reqFunction;    /* Requested function */\
  591.     DETTargetSpecification target;        /* The target for the request */
  592.  
  593. #define DETCallBackBlockPropertyHeader \
  594.     DETCallBackFunctions reqFunction;    /* Requested function */\
  595.     DETTargetSpecification target;        /* The target for the request */\
  596.     short property;                        /* The property to apply the request to */
  597.  
  598.  
  599. struct DETProtoCallBackBlock {
  600.     DETCallBackBlockPropertyHeader
  601. };
  602.  
  603. typedef struct DETProtoCallBackBlock DETProtoCallBackBlock;
  604.  
  605.  
  606. struct DETBeepBlock {
  607.     DETCallBackBlockHeader
  608. };
  609.  
  610. typedef struct DETBeepBlock DETBeepBlock;
  611.  
  612. struct DETBusyBlock {
  613.     DETCallBackBlockHeader
  614. };
  615.  
  616. typedef struct DETBusyBlock DETBusyBlock;
  617.  
  618. struct DETChangeCallForsBlock {
  619.     DETCallBackBlockTargetedHeader
  620.     long newCallFors;                    /*  -> New call-for mask */
  621. };
  622.  
  623. typedef struct DETChangeCallForsBlock DETChangeCallForsBlock;
  624.  
  625. struct DETGetCommandSelectionCountBlock {
  626.     DETCallBackBlockHeader
  627.     long count;                            /* <-  The number of items in the command selection list */
  628. };
  629.  
  630. typedef struct DETGetCommandSelectionCountBlock DETGetCommandSelectionCountBlock;
  631.  
  632. enum DETItemType {
  633.     kDETHFSType = 0,                /* HFS item type */
  634.     kDETDSType,                        /* Catalog Service item type */
  635.     kDETMailType,                    /* Mail (letter) item type */
  636.     kDETMoverType,                    /* Sounds, fonts, etc., from inside a suitcase or system file */
  637.     kDETLastItemType = 0xF0000000    /* Force it to be a long (C & C++ seem to disagree about the definition of 0xF000) */
  638. };
  639.  
  640. typedef enum DETItemType DETItemType;
  641.  
  642. struct DETFSInfo {                /* FSSpec plus possibly interesting additional info */
  643.     OSType fileType;            /* File type */
  644.     OSType fileCreator;            /* File creator */
  645.     unsigned short fdFlags;        /* Finder flags */
  646.     FSSpec fsSpec;                /* FSSpec */
  647. };
  648.  
  649. typedef struct DETFSInfo DETFSInfo;
  650.  
  651. struct DETGetCommandItemNBlock {
  652.     DETCallBackBlockHeader
  653.     long itemNumber;                    /*  -> Item number to retrieve (1-based) */
  654.     DETItemType itemType;                /*  -> Type of item to be returned (if we can interpret it as such) */
  655.     union {
  656.         DETFSInfo** fsInfo;                /* <-  FSSpec & info for item (caller must DisposHandle() when done) */
  657.         struct {
  658.             PackedDSSpecPtr* dsSpec;    /* <-  DSSpec for item (caller must DisposHandle() when done) */
  659.             short refNum;                /* <-  Refnum for returned address */
  660.             AuthIdentity identity;        /* <-  Identity for returned address */
  661.         } ds;
  662.         PackedDSSpecPtr* dsSpec;        /* <-  DSSpec for item (caller must DisposHandle() when done) */
  663.         LetterSpec** ltrSpec;            /* <-  Letter spec for item (caller must DisposHandle() when done) */
  664.     } item;
  665. };
  666.  
  667. typedef struct DETGetCommandItemNBlock DETGetCommandItemNBlock;
  668.  
  669. struct DETGetDSSpecBlock {
  670.     DETCallBackBlockTargetedHeader
  671.     PackedDSSpecPtr* dsSpec;            /* <-  Handle with result (caller must DisposHandle() when done) */
  672.     short refNum;                        /* <-  Refnum for address if PD */
  673.     AuthIdentity identity;                /* <-  Identity for address */
  674.     Boolean isAlias;                    /* <-  True if this entry is an alias */
  675.     Boolean isRecordRef;                /* <-  True if this entry is a record reference (reserved) */
  676. };
  677.  
  678. typedef struct DETGetDSSpecBlock DETGetDSSpecBlock;
  679.  
  680. struct DETGetTemplateFSSpecBlock {
  681.     DETCallBackBlockTargetedHeader
  682.     FSSpec fsSpec;                        /* <-  FSSpec of template file */
  683.     short baseID;                        /* <-  Base ID of this template */
  684.     long aspectTemplateNumber;            /* <-  The template number for this aspect template */
  685. };
  686.  
  687. typedef struct DETGetTemplateFSSpecBlock DETGetTemplateFSSpecBlock;
  688.  
  689. struct DETGetOpenEditBlock {
  690.     DETCallBackBlockTargetedHeader
  691.     short viewProperty;                    /* <-  The property of the view being edited (or kNoProperty if none) */
  692. };
  693.  
  694. typedef struct DETGetOpenEditBlock DETGetOpenEditBlock;
  695.  
  696. struct DETCloseEditBlock {
  697.     DETCallBackBlockTargetedHeader
  698. };
  699.  
  700. typedef struct DETCloseEditBlock DETCloseEditBlock;
  701.  
  702. struct DETGetPropertyTypeBlock {
  703.     DETCallBackBlockPropertyHeader
  704.     short propertyType;                    /* <-  The type of the property */
  705. };
  706.  
  707. typedef struct DETGetPropertyTypeBlock DETGetPropertyTypeBlock;
  708.  
  709. struct DETGetPropertyNumberBlock {
  710.     DETCallBackBlockPropertyHeader
  711.     unsigned long propertyValue;        /* <-  The value of the property */
  712. };
  713.  
  714. typedef struct DETGetPropertyNumberBlock DETGetPropertyNumberBlock;
  715.  
  716. struct DETGetPropertyRStringBlock {
  717.     DETCallBackBlockPropertyHeader
  718.     RStringHandle propertyValue;        /* <-  A handle containing the property (as an RString) (caller must DisposHandle() when done) */
  719. };
  720.  
  721. typedef struct DETGetPropertyRStringBlock DETGetPropertyRStringBlock;
  722.  
  723. struct DETGetPropertyBinarySizeBlock {
  724.     DETCallBackBlockPropertyHeader
  725.     long propertyBinarySize;            /* <-  The size of the property as a binary block */
  726. };
  727.  
  728. typedef struct DETGetPropertyBinarySizeBlock DETGetPropertyBinarySizeBlock;
  729.  
  730. struct DETGetPropertyBinaryBlock {
  731.     DETCallBackBlockPropertyHeader
  732.     Handle propertyValue;                /* <-  Handle with the value of the property (caller must DisposHandle() when done) */
  733. };
  734.  
  735. typedef struct DETGetPropertyBinaryBlock DETGetPropertyBinaryBlock;
  736.  
  737. struct DETGetPropertyChangedBlock {
  738.     DETCallBackBlockPropertyHeader
  739.     Boolean propertyChanged;            /* <-  True if the property is marked as changed */
  740. };
  741.  
  742. typedef struct DETGetPropertyChangedBlock DETGetPropertyChangedBlock;
  743.  
  744. struct DETGetPropertyEditableBlock {
  745.     DETCallBackBlockPropertyHeader
  746.     Boolean propertyEditable;            /* <-  True if the property can be edited by the user (if false, view will appear disabled) */
  747. };
  748.  
  749. typedef struct DETGetPropertyEditableBlock DETGetPropertyEditableBlock;
  750.  
  751. struct DETSetPropertyTypeBlock {
  752.     DETCallBackBlockPropertyHeader
  753.     short newType;                        /*  -> New type for property (just sets type, does not convert contents) */
  754. };
  755.  
  756. typedef struct DETSetPropertyTypeBlock DETSetPropertyTypeBlock;
  757.  
  758. struct DETSetPropertyNumberBlock {
  759.     DETCallBackBlockPropertyHeader
  760.     unsigned long newValue;                /*  -> New value to set property to (and set type to number) */
  761. };
  762.  
  763. typedef struct DETSetPropertyNumberBlock DETSetPropertyNumberBlock;
  764.  
  765. struct DETSetPropertyRStringBlock {
  766.     DETCallBackBlockPropertyHeader
  767.     RStringPtr newValue;                /*  -> New value to set property to (and set type to RString) */
  768. };
  769.  
  770. typedef struct DETSetPropertyRStringBlock DETSetPropertyRStringBlock;
  771.  
  772. struct DETSetPropertyBinaryBlock {
  773.     DETCallBackBlockPropertyHeader
  774.     Ptr newValue;                        /*  -> New value to set property to (and set type to binary) */
  775.     long newValueSize;                    /*  -> Size of new value */
  776. };
  777.  
  778. typedef struct DETSetPropertyBinaryBlock DETSetPropertyBinaryBlock;
  779.  
  780. struct DETSetPropertyChangedBlock {
  781.     DETCallBackBlockPropertyHeader
  782.     Boolean propertyChanged;            /*  -> Value to set changed flag on property to */
  783. };
  784.  
  785. typedef struct DETSetPropertyChangedBlock DETSetPropertyChangedBlock;
  786.  
  787. struct DETSetPropertyEditableBlock {
  788.     DETCallBackBlockPropertyHeader
  789.     Boolean propertyEditable;            /*  -> Value to set editable flag on property to */
  790. };
  791.  
  792. typedef struct DETSetPropertyEditableBlock DETSetPropertyEditableBlock;
  793.  
  794. struct DETDirtyPropertyBlock {
  795.     DETCallBackBlockPropertyHeader
  796. };
  797.  
  798. typedef struct DETDirtyPropertyBlock DETDirtyPropertyBlock;
  799.  
  800. struct DETDoPropertyCommandBlock {
  801.     DETCallBackBlockPropertyHeader
  802.     long parameter;                        /* ->  Parameter of command */
  803. };
  804.  
  805. typedef struct DETDoPropertyCommandBlock DETDoPropertyCommandBlock;
  806.  
  807. struct DETSublistCountBlock {
  808.     DETCallBackBlockTargetedHeader
  809.     long count;                            /* <-  The number of items in the current item's sublist */
  810. };
  811.  
  812. typedef struct DETSublistCountBlock DETSublistCountBlock;
  813.  
  814. struct DETSelectedSublistCountBlock {
  815.     DETCallBackBlockTargetedHeader
  816.     long count;                            /* <-  The number of selected items in the current item's sublist */
  817. };
  818.  
  819. typedef struct DETSelectedSublistCountBlock DETSelectedSublistCountBlock;
  820.  
  821. struct DETRequestSyncBlock {
  822.     DETCallBackBlockTargetedHeader
  823. };
  824.  
  825. typedef struct DETRequestSyncBlock DETRequestSyncBlock;
  826.  
  827. struct DETAddMenuBlock {
  828.     DETCallBackBlockPropertyHeader
  829.     RString* name;                        /*  -> Name of new menu item */
  830.     long parameter;                        /*  -> Parameter to return when this item is selected */
  831.     long addAfter;                        /*  -> Parameter of entry to add after, or -1 for add at end */
  832. };
  833.  
  834. typedef struct DETAddMenuBlock DETAddMenuBlock;
  835.  
  836. struct DETRemoveMenuBlock {
  837.     DETCallBackBlockPropertyHeader
  838.     long itemToRemove;                    /*  -> Parameter of menu item to remove */
  839. };
  840.  
  841. typedef struct DETRemoveMenuBlock DETRemoveMenuBlock;
  842.  
  843. struct DETMenuItemRStringBlock {
  844.     DETCallBackBlockPropertyHeader
  845.     long itemParameter;                    /*  -> Parameter of menu item to return string for */
  846.     RStringHandle rString;                /* <-  Handle with the RString (caller must DisposHandle() when done) */
  847. };
  848.  
  849. typedef struct DETMenuItemRStringBlock DETMenuItemRStringBlock;
  850.  
  851. struct DETOpenDSSpecBlock {
  852.     DETCallBackBlockHeader
  853.     PackedDSSpecPtr dsSpec;                /*  -> DSSpec of object to be opened */
  854. };
  855.  
  856. typedef struct DETOpenDSSpecBlock DETOpenDSSpecBlock;
  857.  
  858. struct DETAboutToTalkBlock {
  859.     DETCallBackBlockHeader
  860. };
  861.  
  862. typedef struct DETAboutToTalkBlock DETAboutToTalkBlock;
  863.  
  864. struct DETBreakAttributeBlock {
  865.     DETCallBackBlockTargetedHeader
  866.     AttributePtr breakAttribute;        /*  -> Attribute to parse */
  867.     Boolean isChangeable;                /*  -> True if the value can be changed by the user */
  868. };
  869.  
  870. typedef struct DETBreakAttributeBlock DETBreakAttributeBlock;
  871.  
  872. struct DETSavePropertyBlock {
  873.     DETCallBackBlockPropertyHeader
  874. };
  875.  
  876. typedef struct DETSavePropertyBlock DETSavePropertyBlock;
  877.  
  878. struct DETGetCustomViewUserReferenceBlock {
  879.     DETCallBackBlockPropertyHeader
  880.     short userReference;                /* <-  User reference value, as specified in the .r file */
  881. };
  882.  
  883. typedef struct DETGetCustomViewUserReferenceBlock DETGetCustomViewUserReferenceBlock;
  884.  
  885. struct DETGetCustomViewBoundsBlock {
  886.     DETCallBackBlockPropertyHeader
  887.     Rect bounds;                        /* <-  Bounds of the view */
  888. };
  889.  
  890. typedef struct DETGetCustomViewBoundsBlock DETGetCustomViewBoundsBlock;
  891.  
  892. struct DETGetResourceBlock {
  893.     DETCallBackBlockPropertyHeader
  894.     ResType resourceType;                /*  -> Resource type */
  895.     Handle theResource;                    /* <-  The resource handle (caller must dispose when done) */
  896. };
  897.  
  898. typedef struct DETGetResourceBlock DETGetResourceBlock;
  899.  
  900. struct DETTemplateCounts {
  901.     DETCallBackBlockHeader
  902.     long aspectTemplateCount;            /* <-  Number of aspect templates in the system */
  903.     long infoPageTemplateCount;            /* <-  Number of info-page templates in the system */
  904. };
  905.  
  906. typedef struct DETTemplateCounts DETTemplateCounts;
  907.  
  908. struct DETUnloadTemplatesBlock {
  909.     DETCallBackBlockHeader
  910. };
  911.  
  912. typedef struct DETUnloadTemplatesBlock DETUnloadTemplatesBlock;
  913.  
  914.  
  915. union DETCallBackBlock {
  916.     DETProtoCallBackBlock                    protoCallBack;
  917.     DETBeepBlock                            beep;
  918.     DETBusyBlock                            busy;
  919.     DETChangeCallForsBlock                    changeCallFors;
  920.     DETGetCommandSelectionCountBlock        getCommandSelectionCount;
  921.     DETGetCommandItemNBlock                    getCommandItemN;
  922.     DETGetDSSpecBlock                        getDSSpec;
  923.     DETGetTemplateFSSpecBlock                getTemplateFSSpec;
  924.     DETGetOpenEditBlock                        getOpenEdit;
  925.     DETCloseEditBlock                        closeEdit;
  926.     DETGetPropertyTypeBlock                    getPropertyType;
  927.     DETGetPropertyNumberBlock                getPropertyNumber;
  928.     DETGetPropertyRStringBlock                getPropertyRString;
  929.     DETGetPropertyBinarySizeBlock            getPropertyBinarySize;
  930.     DETGetPropertyBinaryBlock                getPropertyBinary;
  931.     DETGetPropertyChangedBlock                getPropertyChanged;
  932.     DETGetPropertyEditableBlock                getPropertyEditable;
  933.     DETSetPropertyTypeBlock                    setPropertyType;
  934.     DETSetPropertyNumberBlock                setPropertyNumber;
  935.     DETSetPropertyRStringBlock                setPropertyRString;
  936.     DETSetPropertyBinaryBlock                setPropertyBinary;
  937.     DETSetPropertyChangedBlock                setPropertyChanged;
  938.     DETSetPropertyEditableBlock                setPropertyEditable;
  939.     DETDirtyPropertyBlock                    dirtyProperty;
  940.     DETDoPropertyCommandBlock                doPropertyCommand;
  941.     DETSublistCountBlock                    sublistCount;
  942.     DETSelectedSublistCountBlock            selectedSublistCount;
  943.     DETRequestSyncBlock                        requestSync;
  944.     DETAddMenuBlock                            addMenu;
  945.     DETRemoveMenuBlock                        removeMenu;
  946.     DETMenuItemRStringBlock                    menuItemRString;
  947.     DETOpenDSSpecBlock                        openDSSpec;
  948.     DETAboutToTalkBlock                        aboutToTalk;
  949.     DETBreakAttributeBlock                    breakAttribute;
  950.     DETSavePropertyBlock                    saveProperty;
  951.     DETGetCustomViewUserReferenceBlock        getCustomViewUserReference;
  952.     DETGetCustomViewBoundsBlock                getCustomViewBounds;
  953.     DETGetResourceBlock                        getResource;
  954.     DETTemplateCounts                        templateCounts;
  955.     DETUnloadTemplatesBlock                    unloadTemplates;
  956. };
  957.  
  958. typedef union DETCallBackBlock DETCallBackBlock;
  959. typedef DETCallBackBlock* DETCallBackBlockPtr;
  960.  
  961.  
  962. typedef pascal OSErr (*DETCallBack) (union DETCallBlock* callBlockPtr, DETCallBackBlockPtr callBackBlockPtr);
  963.  
  964.  
  965. /* Call functions:
  966.  
  967.         reqFunction                        Action
  968.         -----------                        ------
  969.         kDETcmdInit                        Called once when template is first loaded (good time to allocate private data); returns call-for list
  970.         kDETcmdExit                        Called once when template is freed (good time to free private data)
  971.  
  972.         kDETcmdAttributeCreation        New sublist attribute creation about to occur; this gives the template a chance to modify
  973.                                         the value that's about to be created; sent to the template that will be used for
  974.                                         the main aspect of the new entry
  975.  
  976.         kDETcmdDynamicForwarders        Return a list of dynamically created forwarders
  977.  
  978.         kDETcmdInstanceInit                Called once when instance of template is started (good time to allocate private instance data)
  979.         kDETcmdInstanceExit                Called once when instance is ended (good time to free private instance data)
  980.  
  981.         kDETcmdIdle                        Called periodically during idle times
  982.  
  983.         kDETcmdViewListChanged            Called when the info-page view-list (list of enabled views) has changed
  984.  
  985.         kDETcmdValidateSave                Validate save: about to save info-page, return noErr (or kDETDidNotHandle) if it's OK to do so
  986.  
  987.         kDETcmdDropQuery                Drop query: return the appropriate operation for this drag; ask destination
  988.         kDETcmdDropMeQuery                Drop query: return the appropriate operation for this drag; ask dropee
  989.  
  990.         kDETcmdAttributeNew                Attribute value new (return kDETDidNotHandle to let normal new processing occur)
  991.         kDETcmdAttributeChange            Attribute value change (return kDETDidNotHandle to let normal change processing occur)
  992.         kDETcmdAttributeDelete            Attribute value delete (return kDETDidNotHandle to let normal deletion occur); sent to the
  993.                                         main aspect of the attribute that's about to be deleted
  994.         kDETcmdItemNew                    Target item (record or attribute) has just been created
  995.  
  996.         kDETcmdOpenSelf                    Self open (return noErr to prevent opening; return kDETDidNotHandle to allow it)
  997.  
  998.         kDETcmdDynamicResource            Return a dynamically created resource
  999.  
  1000.         kDETcmdShouldSync                Check if the code resource wants to force a sync (update data from catalog)
  1001.         kDETcmdDoSync                    Give code resource a chance to sync (read in and break all attributes)
  1002.  
  1003.         kDETcmdPropertyCommand            Command received in the property number range (usually means a button's been pushed)
  1004.  
  1005.         kDETcmdMaximumTextLength        Return maximum size for text form of property
  1006.  
  1007.         kDETcmdPropertyDirtied            Property dirtied, need to redraw
  1008.  
  1009.         kDETcmdPatternIn                Custom pattern element encountered on reading in an attribute
  1010.         kDETcmdPatternOut                Custom pattern element encountered on writing out an attribute
  1011.  
  1012.         kDETcmdConvertToNumber            Convert from template-defined property type to number
  1013.         kDETcmdConvertToRString            Convert from template-defined property type to RString
  1014.         kDETcmdConvertFromNumber        Convert from number to template-defined property type
  1015.         kDETcmdConvertFromRString        Convert from RString to template-defined property type
  1016.  
  1017.         kDETcmdCustomViewDraw            Custom view draw
  1018.         kDETcmdCustomViewMouseDown        Custom view mouse down
  1019.  
  1020.         kDETcmdKeyPress                    Key press (used primarily to filter entry into EditText views)
  1021.         kDETcmdPaste                    Paste (used primarily to filter entry into EditText views)
  1022.  
  1023.         kDETcmdCustomMenuSelected        Custom Catalogs menu selected
  1024.         kDETcmdCustomMenuEnabled        Return whether custom Catalogs menu entry should be enabled
  1025. */
  1026.  
  1027.  
  1028. enum DETCallFunctions {
  1029.  
  1030.     kDETcmdSimpleCall = 0,
  1031.     kDETcmdInit,
  1032.     kDETcmdExit,
  1033.     kDETcmdAttributeCreation,
  1034.     kDETcmdDynamicForwarders,
  1035.  
  1036.     kDETcmdTargetedCall = 1000,
  1037.     kDETcmdInstanceInit,
  1038.     kDETcmdInstanceExit,
  1039.     kDETcmdIdle,
  1040.     kDETcmdViewListChanged,
  1041.     kDETcmdValidateSave,
  1042.     kDETcmdDropQuery,
  1043.     kDETcmdDropMeQuery,
  1044.     kDETcmdAttributeNew,
  1045.     kDETcmdAttributeChange,
  1046.     kDETcmdAttributeDelete,
  1047.     kDETcmdItemNew,
  1048.     kDETcmdOpenSelf,
  1049.     kDETcmdDynamicResource,
  1050.     kDETcmdShouldSync,
  1051.     kDETcmdDoSync,
  1052.  
  1053.     kDETcmdPropertyCall = 2000,
  1054.     kDETcmdPropertyCommand,
  1055.     kDETcmdMaximumTextLength,
  1056.     kDETcmdPropertyDirtied,
  1057.     kDETcmdPatternIn,
  1058.     kDETcmdPatternOut,
  1059.     kDETcmdConvertToNumber,
  1060.     kDETcmdConvertToRString,
  1061.     kDETcmdConvertFromNumber,
  1062.     kDETcmdConvertFromRString,
  1063.     kDETcmdCustomViewDraw,
  1064.     kDETcmdCustomViewMouseDown,
  1065.     kDETcmdKeyPress,
  1066.     kDETcmdPaste,
  1067.     kDETcmdCustomMenuSelected,
  1068.     kDETcmdCustomMenuEnabled,
  1069.  
  1070.     kDETcmdHighCall = 0xF0000000    /* Force the type to be long */
  1071. };
  1072.  
  1073. typedef enum DETCallFunctions DETCallFunctions;
  1074.  
  1075.  
  1076. #define DETCallBlockHeader \
  1077.     DETCallFunctions reqFunction;    /* Requested function */\
  1078.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1079.     long callBackPrivate;            /* Private data for the call-back routine */\
  1080.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1081.                                         common to all invocations of code resource) */
  1082.  
  1083. #define DETCallBlockTargetedHeader \
  1084.     DETCallFunctions reqFunction;    /* Requested function */\
  1085.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1086.     long callBackPrivate;            /* Private data for the call-back routine */\
  1087.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1088.                                         common to all invocations of code resource) */\
  1089.     long instancePrivate;            /* Private storage for use by code resource (separate for each item using the\
  1090.                                         code resource) */\
  1091.     DETTargetSpecification target;    /* The target (originator) of the call, for targeted and property calls */\
  1092.     Boolean targetIsMainAspect;        /* True if the target is the main aspect (even though it has a non-nil name) */
  1093.  
  1094. #define DETCallBlockPropertyHeader \
  1095.     DETCallFunctions reqFunction;    /* Requested function */\
  1096.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1097.     long callBackPrivate;            /* Private data for the call-back routine */\
  1098.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1099.                                         common to all invocations of code resource) */\
  1100.     long instancePrivate;            /* Private storage for use by code resource (separate for each item using the\
  1101.                                         code resource) */\
  1102.     DETTargetSpecification target;    /* The target (originator) of the call, for targeted and property calls */\
  1103.     Boolean targetIsMainAspect;        /* True if the target is the main aspect (even though it has a non-nil name) */\
  1104.     short property;                    /* The property number the call refers to */
  1105.  
  1106.  
  1107. struct DETProtoCallBlock {
  1108.     DETCallBlockPropertyHeader
  1109. };
  1110.  
  1111. typedef struct DETProtoCallBlock DETProtoCallBlock;
  1112.  
  1113. struct DETInitBlock {
  1114.     DETCallBlockHeader
  1115.     long newCallFors;                /* <-  New call-for mask */
  1116. };
  1117.  
  1118. typedef struct DETInitBlock DETInitBlock;
  1119.  
  1120. struct DETExitBlock {
  1121.     DETCallBlockHeader
  1122. };
  1123.  
  1124. typedef struct DETExitBlock DETExitBlock;
  1125.  
  1126. struct DETInstanceInitBlock {
  1127.     DETCallBlockTargetedHeader
  1128. };
  1129.  
  1130. typedef struct DETInstanceInitBlock DETInstanceInitBlock;
  1131.  
  1132. struct DETInstanceExitBlock {
  1133.     DETCallBlockTargetedHeader
  1134. };
  1135.  
  1136. typedef struct DETInstanceExitBlock DETInstanceExitBlock;
  1137.  
  1138. struct DETInstanceIdleBlock {
  1139.     DETCallBlockTargetedHeader
  1140. };
  1141.  
  1142. typedef struct DETInstanceIdleBlock DETInstanceIdleBlock;
  1143.  
  1144. struct DETPropertyCommandBlock {
  1145.     DETCallBlockPropertyHeader
  1146.     long parameter;                    /*  -> Parameter of command */
  1147. };
  1148.  
  1149. typedef struct DETPropertyCommandBlock DETPropertyCommandBlock;
  1150.  
  1151. struct DETMaximumTextLengthBlock {
  1152.     DETCallBlockPropertyHeader
  1153.     long maxSize;                    /* <-  Return the maximum number of characters the user can entry when property is edited in an EditText */
  1154. };
  1155.  
  1156. typedef struct DETMaximumTextLengthBlock DETMaximumTextLengthBlock;
  1157.  
  1158. struct DETViewListChangedBlock {
  1159.     DETCallBlockTargetedHeader
  1160. };
  1161.  
  1162. typedef struct DETViewListChangedBlock DETViewListChangedBlock;
  1163.  
  1164. struct DETPropertyDirtiedBlock {
  1165.     DETCallBlockPropertyHeader
  1166. };
  1167.  
  1168. typedef struct DETPropertyDirtiedBlock DETPropertyDirtiedBlock;
  1169.  
  1170. struct DETValidateSaveBlock {
  1171.     DETCallBlockTargetedHeader
  1172.     RStringHandle errorString;        /* <-  Handle with error string if validation fails (callee must allocate handle, DE will DisposHandle() it) */
  1173. };
  1174.  
  1175. typedef struct DETValidateSaveBlock DETValidateSaveBlock;
  1176.  
  1177. /* Valid commandIDs for DETDropQueryBlock and DETDropMeQueryBlock (in addition to property numbers): */
  1178. #define kDETDoNothing    'xxx0'
  1179. #define kDETMove        'move'
  1180. #define kDETDrag        'drag'
  1181. #define kDETAlias        'alis'
  1182.  
  1183. struct DETDropQueryBlock {
  1184.     DETCallBlockTargetedHeader
  1185.     short modifiers;                /*  -> Modifiers at drop time (option/control/command/shift keys) */
  1186.     long commandID;                    /* <-> Command ID (kDETDoNothing, kDETMove, kDETDrag (copy), kDETAlias, or a property number) */
  1187.     AttributeType destinationType;    /* <-> Type to convert attribute to */
  1188.     Boolean copyToHFS;                /* <-  If true, object should be copied to HFS before being operated on, and deleted after */
  1189. };
  1190.  
  1191. typedef struct DETDropQueryBlock DETDropQueryBlock;
  1192.  
  1193. struct DETDropMeQueryBlock {
  1194.     DETCallBlockTargetedHeader
  1195.     short modifiers;                /*  -> Modifiers at drop time (option/control/command/shift keys) */
  1196.     long commandID;                    /* <-> Command ID (kDETDoNothing, kDETMove, kDETDrag (copy), kDETAlias, or a property number) */
  1197.     AttributeType destinationType;    /* <-> Type to convert attribute to */
  1198.     Boolean copyToHFS;                /* <-  If true, object should be copied to HFS before being operated on, and deleted after */
  1199. };
  1200.  
  1201. typedef struct DETDropMeQueryBlock DETDropMeQueryBlock;
  1202.  
  1203. struct DETAttributeCreationBlock {
  1204.     DETCallBlockHeader
  1205.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1206.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1207.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1208.     AttributeType attrType;            /* <-> The type of the attribute being created */
  1209.     AttributeTag attrTag;            /* <-> The tag of the attribute being created */
  1210.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1211. };
  1212.  
  1213. typedef struct DETAttributeCreationBlock DETAttributeCreationBlock;
  1214.  
  1215. struct DETAttributeNewBlock {
  1216.     DETCallBlockTargetedHeader
  1217.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1218.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1219.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1220.     AttributeType attrType;            /* <-> The type of the attribute being created */
  1221.     AttributeTag attrTag;            /* <-> The tag of the attribute being created */
  1222.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1223. };
  1224.  
  1225. typedef struct DETAttributeNewBlock DETAttributeNewBlock;
  1226.  
  1227. struct DETAttributeChangeBlock {
  1228.     DETCallBlockTargetedHeader
  1229.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1230.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1231.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1232.     AttributeType attrType;            /* <-> The type of the attribute being changed */
  1233.     AttributeTag attrTag;            /* <-> The tag of the attribute being changed */
  1234.     AttributeCreationID attrCID;    /* <-> The CID of the attribute being changed */
  1235.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1236. };
  1237.  
  1238. typedef struct DETAttributeChangeBlock DETAttributeChangeBlock;
  1239.  
  1240. struct DETAttributeDeleteBlock {
  1241.     DETCallBlockTargetedHeader
  1242.     PackedDSSpecPtr dsSpec;            /*  -> The object which will be deleted */
  1243.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1244.     AuthIdentity identity;            /*  -> The identity we're browsing as */
  1245. };
  1246.  
  1247. typedef struct DETAttributeDeleteBlock DETAttributeDeleteBlock;
  1248.  
  1249. struct DETItemNewBlock {
  1250.     DETCallBlockTargetedHeader
  1251. };
  1252.  
  1253. typedef struct DETItemNewBlock DETItemNewBlock;
  1254.  
  1255. struct DETShouldSyncBlock {
  1256.     DETCallBlockTargetedHeader
  1257.     Boolean shouldSync;                /* <-  True if we should now sync with catalog */
  1258. };
  1259.  
  1260. typedef struct DETShouldSyncBlock DETShouldSyncBlock;
  1261.  
  1262. struct DETDoSyncBlock {
  1263.     DETCallBlockTargetedHeader
  1264. };
  1265.  
  1266. typedef struct DETDoSyncBlock DETDoSyncBlock;
  1267.  
  1268. struct DETPatternInBlock {
  1269.     DETCallBlockPropertyHeader
  1270.     long elementType;                /*  -> Element type from pattern */
  1271.     long extra;                        /*  -> Extra field from pattern */
  1272.     AttributePtr attribute;            /*  -> The complete attribute */
  1273.     long dataOffset;                /* <-> Offset to current (next) byte */
  1274.     short bitOffset;                /* <-> Bit offset (next bit is *fData >> fBitOffset++) */
  1275. };
  1276.  
  1277. typedef struct DETPatternInBlock DETPatternInBlock;
  1278.  
  1279. struct DETPatternOutBlock {
  1280.     DETCallBlockPropertyHeader
  1281.     long elementType;                /*  -> Element type from pattern */
  1282.     long extra;                        /*  -> Extra field from pattern */
  1283.     AttributePtr attribute;            /*  -> The attribute (minus the data portion) */
  1284.     Handle data;                    /*  -> Data to be written (pre-allocated, resize and add at end) */
  1285.     long dataOffset;                /* <-> Offset to next byte to write */
  1286.     short bitOffset;                /* <-> Bit offset (if zero, handle will need to be resized to one more byte before write) */
  1287. };
  1288.  
  1289. typedef struct DETPatternOutBlock DETPatternOutBlock;
  1290.  
  1291. struct DETOpenSelfBlock {
  1292.     DETCallBlockTargetedHeader
  1293.     short modifiers;                /*  -> Modifiers at open time (option/control/command/shift keys) */
  1294. };
  1295.  
  1296. typedef struct DETOpenSelfBlock DETOpenSelfBlock;
  1297.  
  1298. struct DETConvertToNumberBlock {
  1299.     DETCallBlockPropertyHeader
  1300.     long theValue;                    /* <-  The converted value to return */
  1301. };
  1302.  
  1303. typedef struct DETConvertToNumberBlock DETConvertToNumberBlock;
  1304.  
  1305. struct DETConvertToRStringBlock {
  1306.     DETCallBlockPropertyHeader
  1307.     RStringHandle theValue;            /* <-  A handle with the converted value (callee must allocate handle, DE will DisposHandle() it) */
  1308. };
  1309.  
  1310. typedef struct DETConvertToRStringBlock DETConvertToRStringBlock;
  1311.  
  1312. struct DETConvertFromNumberBlock {
  1313.     DETCallBlockPropertyHeader
  1314.     long theValue;                    /*  -> The value to convert (result should be written direct to the property) */
  1315. };
  1316.  
  1317. typedef struct DETConvertFromNumberBlock DETConvertFromNumberBlock;
  1318.  
  1319. struct DETConvertFromRStringBlock {
  1320.     DETCallBlockPropertyHeader
  1321.     RStringPtr theValue;            /*  -> The value to convert (result should be written direct to the property) */
  1322. };
  1323.  
  1324. typedef struct DETConvertFromRStringBlock DETConvertFromRStringBlock;
  1325.  
  1326. struct DETCustomViewDrawBlock {
  1327.     DETCallBlockPropertyHeader
  1328. };
  1329.  
  1330. typedef struct DETCustomViewDrawBlock DETCustomViewDrawBlock;
  1331.  
  1332. struct DETCustomViewMouseDownBlock {
  1333.     DETCallBlockPropertyHeader
  1334.     EventRecord* theEvent;            /*  -> The original event record of the mouse-down */
  1335. };
  1336.  
  1337. typedef struct DETCustomViewMouseDownBlock DETCustomViewMouseDownBlock;
  1338.  
  1339. struct DETKeyPressBlock {
  1340.     DETCallBlockPropertyHeader
  1341.     EventRecord* theEvent;            /*  -> The original event record of the key-press */
  1342. };
  1343.  
  1344. typedef struct DETKeyPressBlock DETKeyPressBlock;
  1345.  
  1346. struct DETPasteBlock {
  1347.     DETCallBlockPropertyHeader
  1348.     short modifiers;                /*  -> Modifiers at paste time (option/control/command/shift keys) */
  1349. };
  1350.  
  1351. typedef struct DETPasteBlock DETPasteBlock;
  1352.  
  1353. struct DETCustomMenuSelectedBlock {
  1354.     DETCallBlockTargetedHeader
  1355.     short menuTableParameter;        /*  -> The "property" field from the custom menu table */
  1356. };
  1357.  
  1358. typedef struct DETCustomMenuSelectedBlock DETCustomMenuSelectedBlock;
  1359.  
  1360. struct DETCustomMenuEnabledBlock {
  1361.     DETCallBlockTargetedHeader
  1362.     short menuTableParameter;        /*  -> The "property" field from the custom menu table */
  1363.     Boolean enable;                    /* <-  Whether to enable the menu item */
  1364. };
  1365.  
  1366. typedef struct DETCustomMenuEnabledBlock DETCustomMenuEnabledBlock;
  1367.  
  1368. struct DETForwarderListItem {
  1369.     struct DETForwarderListItem** next;        /* Pointer to next item, or nil */
  1370.     AttributeTag attributeValueTag;            /* Tag of new templates (0 for none) */
  1371.     PackedPathName rstrs;                    /* Record type (empty if none), attrbute type (empty if none),
  1372.                                                 list of template names to forward to */
  1373. };
  1374.  
  1375. typedef struct DETForwarderListItem** DETForwarderListHandle;
  1376.  
  1377. struct DETDynamicForwardersBlock {
  1378.     DETCallBlockHeader
  1379.     DETForwarderListHandle forwarders;    /* <-  List of forwaders */
  1380. };
  1381.  
  1382. typedef struct DETDynamicForwardersBlock DETDynamicForwardersBlock;
  1383.  
  1384. struct DETDynamicResourceBlock {
  1385.     DETCallBlockTargetedHeader
  1386.     ResType resourceType;                /*  -> The resource type being requested */
  1387.     short propertyNumber;                /*  -> The property number of the resource being requested */
  1388.     short resourceID;                    /*  -> The resource ID (base ID + property number) of the resource */
  1389.     Handle theResource;                    /* <-  The requested resource */
  1390. };
  1391.  
  1392. typedef struct DETDynamicResourceBlock DETDynamicResourceBlock;
  1393.  
  1394.  
  1395. union DETCallBlock {
  1396.     DETProtoCallBlock                protoCall;
  1397.     DETInitBlock                    init;
  1398.     DETExitBlock                    exit;
  1399.     DETInstanceInitBlock            instanceInit;
  1400.     DETInstanceExitBlock            instanceExit;
  1401.     DETInstanceIdleBlock            instanceIdle;
  1402.     DETPropertyCommandBlock            propertyCommand;
  1403.     DETMaximumTextLengthBlock        maximumTextLength;
  1404.     DETViewListChangedBlock            viewListChanged;
  1405.     DETPropertyDirtiedBlock            propertyDirtied;
  1406.     DETValidateSaveBlock            validateSave;
  1407.     DETDropQueryBlock                dropQuery;
  1408.     DETDropMeQueryBlock                dropMeQuery;
  1409.     DETAttributeCreationBlock        attributeCreationBlock;
  1410.     DETAttributeNewBlock            attributeNew;
  1411.     DETAttributeChangeBlock            attributeChange;
  1412.     DETAttributeDeleteBlock            attributeDelete;
  1413.     DETItemNewBlock                    itemNew;
  1414.     DETPatternInBlock                patternIn;
  1415.     DETPatternOutBlock                patternOut;
  1416.     DETShouldSyncBlock                shouldSync;
  1417.     DETDoSyncBlock                    doSync;
  1418.     DETOpenSelfBlock                openSelf;
  1419.     DETConvertToNumberBlock            convertToNumber;
  1420.     DETConvertToRStringBlock        convertToRString;
  1421.     DETConvertFromNumberBlock        convertFromNumber;
  1422.     DETConvertFromRStringBlock        convertFromRString;
  1423.     DETCustomViewDrawBlock            customViewDraw;
  1424.     DETCustomViewMouseDownBlock        customViewMouseDown;
  1425.     DETKeyPressBlock                keyPress;
  1426.     DETPasteBlock                    paste;
  1427.     DETCustomMenuSelectedBlock        customMenuSelected;
  1428.     DETCustomMenuEnabledBlock        customMenuEnabled;
  1429.     DETDynamicForwardersBlock        dynamicForwarders;
  1430.     DETDynamicResourceBlock            dynamicResource;
  1431. };
  1432.  
  1433. typedef union DETCallBlock DETCallBlock;
  1434. typedef DETCallBlock* DETCallBlockPtr;
  1435.  
  1436. /* Call-for list: */
  1437.  
  1438. #define kDETCallForOther               1        /* Call for things not listed below (also auto-enabled by DE if any of the below are enabled) */
  1439. #define kDETCallForIdle                   2        /* kDETcmdIdle */
  1440. #define kDETCallForCommands               4        /* kDETcmdPropertyCommand, kDETcmdSelfOpen */
  1441. #define kDETCallForViewChanges           8        /* kDETcmdViewListChanged, kDETcmdPropertyDirtied, kDETcmdMaximumTextLength */
  1442. #define kDETCallForDrops            0x10        /* kDETcmdDropQuery, kDETcmdDropMeQuery */
  1443. #define kDETCallForAttributes        0x20        /* kDETcmdAttributeCreation, kDETcmdAttributeNew, kDETcmdAttributeChange, kDETcmdAttributeDelete */
  1444. #define kDETCallForValidation        0x40        /* kDETcmdValidateSave */
  1445. #define kDETCallForKeyPresses        0x80        /* kDETcmdKeyPress and kDETcmdPaste */
  1446. #define kDETCallForResources       0x100        /* kDETcmdDynamicResource */
  1447. #define kDETCallForSyncing           0x200        /* kDETcmdShouldSync, kDETcmdDoSync */
  1448. #define kDETCallForEscalation      0x8000        /* All calls escalated from the next lower level */
  1449.  
  1450. #define kDETCallForNothing               0        /* None of the above */
  1451. #define kDETCallForEverything 0xFFFFFFFF        /* All of the above */
  1452.  
  1453.  
  1454. typedef pascal OSErr (*DETCall) (DETCallBlockPtr callBlockPtr);
  1455.  
  1456.  
  1457. /* This following macro saves you from having to dig out the call-back pointer from the call block: */
  1458.  
  1459. #define CallBackDET(callBlockPtr, callBackBlockPtr) ((*callBlockPtr->protoCall.callBack)(callBlockPtr,callBackBlockPtr))
  1460.  
  1461.  
  1462. #endif
  1463.  
  1464. /************************************************************************************/
  1465. /********************************* SAM Definitions: *********************************/
  1466. /************************************************************************************/
  1467.  
  1468. /* SAM Developers should use property numbers starting at this point: */
  1469. #define kSAMFirstDevProperty                kDETFirstDevProperty + 10
  1470.  
  1471.  
  1472. /*
  1473.     SAM templates have additional resources/properties that are required
  1474.     for interaction with the AOCE Key Chain.
  1475.     
  1476.      Type    Offset                        Description
  1477.      ----    ------                        -----------
  1478.     'rstr'    kSAMAspectUserName            The user name
  1479.     'rstr'    kSAMAspectKind                The kind of SAM
  1480.     'detn'    kSAMAspectCannotDelete        If 0, then the slot cannot be deleted
  1481.     'sami'    kSAMAspectSlotCreationInfo    The info required to create a slot record
  1482. */
  1483.  
  1484. #define kSAMAspectUserName                        kDETFirstDevProperty + 1
  1485. #define kSAMAspectKind                            kDETFirstDevProperty + 2
  1486. #define kSAMAspectCannotDelete                    kDETFirstDevProperty + 3
  1487. #define kSAMAspectSlotCreationInfo                kDETFirstDevProperty + 4
  1488.  
  1489.  
  1490. /**************************************************************************************/
  1491. /********************************* Admin Definitions: *********************************/
  1492. /**************************************************************************************/
  1493.  
  1494. #define kDETAdminVersion         -978
  1495.  
  1496.  
  1497. #endif
  1498.  
  1499.